using System;
using System.Collections.Generic;


namespace DataObjects
{
	[Serializable]
	public class PartnerLabourContract: IEquatable<PartnerLabourContract>
	{

		#region Private Members

		private string _contract_no; 
		private int? _months; 
		private DateTime? _effective_date; 
		private DateTime? _end_date; 
		private DateTime? _sign_date; 
		private string _employee_id; 
		private string _partner_id; 
		private string _person_represent; 
		private double _discount; 
		private double _max_dept; 
		private string _document_path; 
		private string _remark; 
		private string _kind_of_contract; 
		private string _status; 		
		#endregion

		#region Constructor

		public PartnerLabourContract()
		{
			_contract_no = String.Empty; 
			_months = new int?(); 
			_effective_date = new DateTime?(); 
			_end_date = new DateTime?(); 
			_sign_date = new DateTime?(); 
			_employee_id = String.Empty; 
			_partner_id = String.Empty; 
			_person_represent = String.Empty; 
			_discount = new double(); 
			_max_dept = new double(); 
			_document_path = String.Empty; 
			_remark = String.Empty; 
			_kind_of_contract = String.Empty; 
			_status = String.Empty; 
		}
		#endregion // End of Default ( Empty ) Class Constuctor

		#region Required Fields Only Constructor
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public PartnerLabourContract(
			string contract_no)
			: this()
		{
			_contract_no = contract_no;
			_months = null;
			_effective_date = null;
			_end_date = null;
			_sign_date = null;
			_employee_id = String.Empty;
			_partner_id = String.Empty;
			_person_represent = String.Empty;
			_discount = 0;
			_max_dept = 0;
			_document_path = String.Empty;
			_remark = String.Empty;
			_kind_of_contract = String.Empty;
			_status = String.Empty;
		}
		#endregion // End Constructor

		#region Public Properties
			
		public virtual string ContractNo
		{
			get
			{ 
				return _contract_no;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for ContractNo", value, "null");
				
				if(  value.Length > 20)
					throw new ArgumentOutOfRangeException("Invalid value for ContractNo", value, value.ToString());
				
				_contract_no = value;
			}
		}
			
		public virtual int? Months
		{
			get
			{ 
				return _months;
			}
			set
			{
				_months = value;
			}

		}
			
		public virtual DateTime? EffectiveDate
		{
			get
			{ 
				return _effective_date;
			}
			set
			{
				_effective_date = value;
			}

		}
			
		public virtual DateTime? EndDate
		{
			get
			{ 
				return _end_date;
			}
			set
			{
				_end_date = value;
			}

		}
			
		public virtual DateTime? SignDate
		{
			get
			{ 
				return _sign_date;
			}
			set
			{
				_sign_date = value;
			}

		}
			
		public virtual string EmployeeId
		{
			get
			{ 
				return _employee_id;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for EmployeeId", value, value.ToString());
				
				_employee_id = value;
			}
		}
			
		public virtual string PartnerId
		{
			get
			{ 
				return _partner_id;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for PartnerId", value, value.ToString());
				
				_partner_id = value;
			}
		}
			
		public virtual string PersonRepresent
		{
			get
			{ 
				return _person_represent;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for PersonRepresent", value, value.ToString());
				
				_person_represent = value;
			}
		}
			
		public virtual double Discount
		{
			get
			{ 
				return _discount;
			}
			set
			{
				_discount = value;
			}

		}
			
		public virtual double MaxDept
		{
			get
			{ 
				return _max_dept;
			}
			set
			{
				_max_dept = value;
			}

		}
			
		public virtual string DocumentPath
		{
			get
			{ 
				return _document_path;
			}

			set	
			{	
				if(  value != null &&  value.Length > 200)
					throw new ArgumentOutOfRangeException("Invalid value for DocumentPath", value, value.ToString());
				
				_document_path = value;
			}
		}
			
		public virtual string Remark
		{
			get
			{ 
				return _remark;
			}

			set	
			{	
				if(  value != null &&  value.Length > 200)
					throw new ArgumentOutOfRangeException("Invalid value for Remark", value, value.ToString());
				
				_remark = value;
			}
		}
			
		public virtual string KindOfContract
		{
			get
			{ 
				return _kind_of_contract;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for KindOfContract", value, value.ToString());
				
				_kind_of_contract = value;
			}
		}
			
		public virtual string Status
		{
			get
			{ 
				return _status;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for Status", value, value.ToString());
				
				_status = value;
			}
		}
			
				
		#endregion 

		#region Public Functions

		#endregion //Public Functions

		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
			PartnerLabourContract castObj = (PartnerLabourContract)obj; 
			return ( castObj != null ) &&
				( this._contract_no == castObj.ContractNo );
		}
		
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
			
			int hash = 57; 
			hash = 27 ^ hash ^ _contract_no.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region IEquatable members

		public bool Equals(PartnerLabourContract other)
		{
			if (other == this)
				return true;
		
			return ( other != null ) &&
				( this._contract_no == other.ContractNo );
				   
		}

		#endregion
		
	}
}
